'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = findChildren;

var _hasClass = require('./hasClass');

var _hasClass2 = _interopRequireDefault(_hasClass);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function findChildren(element, className) {
    if (!element.childNodes.length) {
        return [];
    }

    var nodeArray = Array.prototype.slice.call(element.childNodes);
    if (!className) {
        return nodeArray;
    }

    return nodeArray.filter(function (node) {
        return (0, _hasClass2.default)(node, className);
    });
}